{
 "metadata": {
  "name": "",
  "signature": "sha256:b427bb76034e7435384aa9971496fdcf159d8fd6a18d8305581b9fd7f5dbcf10"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "This is a notebook that is being developed to try out some of the unit testing for SDT3D."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import subprocess\n",
      "def click_handler(widget):\n",
      "    cmd = control_1.value + ' ' + control_2.value\n",
      "    print cmd\n",
      "    p = subprocess.Popen(cmd, shell=True, stdout=None, stderr=None)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 724
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def sdtcmd_handler(widget):\n",
      "    cmd = control_12.value + ' ' + control_22.value\n",
      "    print cmd\n",
      "    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n",
      "    for line in p.stdout.readlines():\n",
      "        print line,\n",
      "    control_22.value=\" \"\n",
      "    retval = p.wait() \n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 725
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def click_handler_unit_test_a(widget):\n",
      "    print unit_test_a\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 726
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def connect(widget):\n",
      "    # Init SDT3d socket and connect\n",
      "    sdtsock.connect((control_13.value,int(control_23.value)))\n",
      "    print \"Connecting to \" + control_13.value + \"/\" + control_23.value\n",
      "    notebookpath = os.getcwd();\n",
      "    send_cmd('path %s/data/'  %(notebookpath))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 727
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def select_test(widget):\n",
      "    print \"Unit test \" + unit_tests.value\n",
      "    \n",
      "    # got to be a better way to get selection!\n",
      "    if unit_tests.value == \"Toggle Layers\":\n",
      "        layer_test()\n",
      "    elif unit_tests.value == \"Node Positioning\":\n",
      "        node_positioning()\n",
      "    elif unit_tests.value == \"Link Test Auto\":\n",
      "        link_test_auto()\n",
      "    elif unit_tests.value == \"Link Test Manual\":\n",
      "        link_test_manual()\n",
      "    elif unit_tests.value == \"Region Tests\":\n",
      "        region_tests()\n",
      "    elif unit_tests.value == \"Sprite Models\":\n",
      "        model_test()\n",
      "    elif unit_tests.value == \"Symbol Tests\":\n",
      "        symbol_test()\n",
      "    elif unit_tests.value == \"View Tests\":\n",
      "        view_tests()\n",
      "    elif unit_tests.value == \"Clear All\":\n",
      "        clear_all()\n",
      "    elif unit_tests.value == \"Delete All\":\n",
      "        delete_all()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 728
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def region_tests():\n",
      "    reset_sdt3d()\n",
      "    delay=5\n",
      "    send_cmd(' origin -120.8026,35.7528,0.0') \n",
      "    send_cmd('view symbol-view-2 viewXml ' + os.getcwd() + '/data/symbol-view-2.xml')\n",
      "    send_cmd('view symbol-view-2')\n",
      "\n",
      "    global region_selection\n",
      "    region_selection = widgets.ToggleButtonsWidget(\n",
      "        description='Region:',value='none',\n",
      "        values=['circle','sphere','square','cube','rectangle','box','none']) \n",
      "    region_selection.on_trait_change(on_region_change,'value')\n",
      "    \n",
      "    popup = widgets.PopupWidget(description=\"Region Tests\")\n",
      "\n",
      "    \n",
      "    slider = widgets.IntSliderWidget(value=0,min=-100.0,max=100.0,step=1, description='Move Region')\n",
      "    slider.on_trait_change(move_region_test, 'value')\n",
      "\n",
      "    popup.children=[region_selection,slider]\n",
      "    display(popup)\n",
      "    \n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 729
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def move_region_test(name,value):\n",
      "    print value\n",
      "    send_cmd('region region1 center 0,%d,100,c' %(value))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 730
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def on_region_change(name,value):\n",
      "    print value\n",
      "\n",
      "    if value == 'none':\n",
      "        send_cmd('delete region,all')\n",
      "    else:\n",
      "        #send_cmd('region region1 shape %s,blue,3,500,500,0.50 center -112.072344,40.5006,1500' %(value))\n",
      "        if value == 'rectangle':\n",
      "           send_cmd('region region1 shape %s,blue,3,150,100,0.50 center 0,0,100,c' %(value))       \n",
      "        else:\n",
      "            send_cmd('region region1 shape %s,blue,3,100,100,0.50 center 0,0,100,c' %(value))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 731
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def symbol_test():\n",
      "    reset_sdt3d()    \n",
      "    delay=5\n",
      "    send_cmd(' origin -120.8026,35.7528,0.0') \n",
      "    send_cmd('view symbol-view-1 viewXml ' + os.getcwd() + '/data/symbol-view-1.xml')\n",
      "    send_cmd('view symbol-view-2 viewXml ' + os.getcwd() + '/data/symbol-view-2.xml')\n",
      "    send_cmd('view symbol-view-3 viewXml ' + os.getcwd() + '/data/symbol-view-3.xml')\n",
      "    send_cmd('view symbol-view-2')\n",
      "    \n",
      "    global sprite_selection\n",
      "    sprite_selection = widgets.ToggleButtonsWidget(\n",
      "        description='Sprite:',\n",
      "        values=['Default Size', 'Fixed Length', 'Scaleable Sized'],)\n",
      "    # Load default sprites\n",
      "    on_sprite_change(\"init\",'Default Size')\n",
      "    \n",
      "    sprite_selection.on_trait_change(on_sprite_change,'value')\n",
      "    \n",
      "    global default_symbols \n",
      "    default_symbols = widgets.ToggleButtonsWidget(\n",
      "        description='Default Size:', value='none',\n",
      "        values=['sphere','cube','cone','cylinder','ellipse','none'])\n",
      "    default_symbols.on_trait_change(on_default_symbol_change,'value')\n",
      "    \n",
      "    global fixed_size_symbols \n",
      "    fixed_size_symbols = widgets.ToggleButtonsWidget(\n",
      "        description='Fixed Size:', value='none',\n",
      "        values=['sphere','cube','cone','cylinder','ellipse','none'])\n",
      "    fixed_size_symbols.on_trait_change(on_fixed_size_symbol_change,'value')\n",
      "    \n",
      "    global scaleable_size_symbols \n",
      "    scaleable_size_symbols = widgets.ToggleButtonsWidget(\n",
      "        description='Scaleable Size:',value='none',\n",
      "        values=['sphere','cube','cone','cylinder','ellipse','none'])\n",
      "    scaleable_size_symbols.on_trait_change(on_scaleable_size_symbol_change,'value')\n",
      "   \n",
      "    global altitude_test\n",
      "    altitude_test = widgets.ToggleButtonsWidget(\n",
      "        description='Altitude:',value='ground',\n",
      "        values=['ground','210 msl','100 agl'])\n",
      "    altitude_test.on_trait_change(on_altitude_test_change,'value')\n",
      "    \n",
      "    global symbol_tests\n",
      "    symbol_tests = widgets.RadioButtonsWidget(\n",
      "        values=['Cone/cylinder orientation tests', \n",
      "               'Absolute/Relative symbol orientation'])\n",
      "    \n",
      "    symbol_test_button = widgets.ButtonWidget(description=\"Select\")\n",
      "    symbol_test_button.on_click(select_symbol_test)\n",
      "\n",
      "    symbol_zoom_slider = widgets.IntSliderWidget(value=0,min=0.0,max=10000.0,step=10, description='Change zoom')\n",
      "    symbol_zoom_slider.on_trait_change(change_zoom, 'value')\n",
      "        \n",
      "    popup = widgets.PopupWidget(description=\"Symbol Tests\")\n",
      "\n",
      "    popup.children=[sprite_selection,default_symbols,fixed_size_symbols,scaleable_size_symbols,\n",
      "                    altitude_test,symbol_tests,symbol_test_button,symbol_zoom_slider]\n",
      "    display(popup)\n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 732
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def on_sprite_change(name,value):\n",
      "    print value\n",
      "    if value == 'Default Size':\n",
      "        send_cmd('popup \"No length or size specified for sprite.  Sprites will remain at default size as view changes\"')\n",
      "        send_cmd('sprite man image 3D_Man_walking.kmz') \n",
      "        send_cmd('sprite warrior image warrior/warrior.3ds ') \n",
      "        send_cmd('sprite uav image uav.png') \n",
      "        send_cmd('node kml-model type man position 0,0,0,c label cyan ') \n",
      "        send_cmd('node 3ds-model type warrior position 0,100,0,c label cyan') \n",
      "        send_cmd('node icon type uav position 0,-100,0,c label cyan') \n",
      "    elif value == 'Fixed Length':\n",
      "        send_cmd('popup \"Length specified.  Sprites sized at given length regardless of view\"')\n",
      "        send_cmd('sprite man64 image 3D_Man_walking.kmz length 64')\n",
      "        send_cmd('node kml-model type man64')\n",
      "        send_cmd('sprite warrior64 image warrior/warrior.3ds length 64')\n",
      "        send_cmd('node 3ds-model type warrior64')\n",
      "        send_cmd('sprite uav64 image uav.png length 64')\n",
      "        send_cmd('node icon type uav64')        \n",
      "    elif value == 'Scaleable Sized':\n",
      "        send_cmd('sprite man32 image 3D_Man_walking.kmz size 32,64')\n",
      "        send_cmd('node kml-model type man32')\n",
      "        send_cmd('sprite warrior32 image warrior/warrior.3ds size 32,32')\n",
      "        send_cmd('node 3ds-model type warrior32')\n",
      "        send_cmd('sprite uav32 image uav.png size 72,20')\n",
      "        send_cmd('node icon type uav32')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 733
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def on_altitude_test_change(name,value):\n",
      "    print value\n",
      "    if value == 'ground':\n",
      "        # In case we changed to msl change back to agl for ground\n",
      "        send_cmd('node kml-model pos x,x,0,x,agl')\n",
      "        send_cmd('node 3ds-model pos x,x,0,x,agl')\n",
      "        send_cmd('node icon pos x,x,0,x,agl')\n",
      "    elif value == '210 msl':\n",
      "        send_cmd('node kml-model pos x,x,210,x,msl')\n",
      "        send_cmd('node 3ds-model pos x,x,210,x,msl')\n",
      "        send_cmd('node icon pos x,x,210,x,msl')    \n",
      "    elif value == '100 agl':\n",
      "        send_cmd('node kml-model pos x,x,100,x,agl')\n",
      "        send_cmd('node 3ds-model pos x,x,100,x,agl')\n",
      "        send_cmd('node icon pos x,x,100,x,agl')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 734
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def on_default_symbol_change(name,value):\n",
      "    print value\n",
      "    if value == 'none':\n",
      "        send_cmd('delete symbol,all')\n",
      "    else:\n",
      "        scaleable_size_symbols.value='none'\n",
      "        fixed_size_symbols.value='none'\n",
      "        send_cmd('node kml-model symbol %s' %(value))\n",
      "        send_cmd('node 3ds-model symbol %s' %(value))\n",
      "        send_cmd('node icon symbol %s' %(value))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 735
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def on_fixed_size_symbol_change(name,value):\n",
      "    print value\n",
      "    if value == 'none':\n",
      "        send_cmd('delete symbol,all')\n",
      "    else:\n",
      "        default_symbols.value='none'\n",
      "        scaleable_size_symbols.value='none'\n",
      "        send_cmd('status \"e.g. node kml-model symbol cube,x,x,64,120\"')\n",
      "        if value == 'sphere':\n",
      "            send_cmd('node kml-model symbol %s,x,x,120' %(value))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,48' %(value))\n",
      "            send_cmd('node icon symbol %s,x,x,64' %(value))\n",
      "        elif value == 'cube':\n",
      "            send_cmd('node kml-model symbol %s,x,x,64,120' %(value))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,35,35' %(value))\n",
      "            send_cmd('node icon symbol %s,x,x,48,35' %(value))\n",
      "        elif value == 'cylinder':\n",
      "            send_cmd('node kml-model symbol %s,x,x,64,2' %(value))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,64,2' %(value))\n",
      "            send_cmd('node icon symbol %s,x,x,64,2' %(value))\n",
      "        elif value == 'cone':\n",
      "            send_cmd('node kml-model symbol %s,x,x,5,32' %(value))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,5,32' %(value))\n",
      "            send_cmd('node icon symbol %s,x,x,5,32' %(value))\n",
      "        elif value == 'ellipse':\n",
      "            send_cmd('node kml-model symbol %s,x,x,42,32' %(value))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,42,32' %(value))                \n",
      "            send_cmd('node icon symbol %s,x,x,42,32' %(value))\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 736
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def on_scaleable_size_symbol_change(name,value):\n",
      "    print value\n",
      "    if value == 'none':\n",
      "        send_cmd('delete symbol,all')\n",
      "    else:\n",
      "        fixed_size_symbols.value='none'\n",
      "        default_symbols.value='none'\n",
      "        send_cmd('status \"e.g. node kml-model symbol cube,x,x,120s,256s\"')\n",
      "        if value == 'sphere':\n",
      "            send_cmd('node kml-model symbol %s,x,x,256s' %(value))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,132s' %(value))\n",
      "            send_cmd('node icon symbol %s,x,x,64s' %(value))\n",
      "        elif value == 'cube':\n",
      "            send_cmd('node kml-model symbol %s,x,x,120s,256s' %(value))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,64s,64s' %(value))\n",
      "            send_cmd('node icon symbol %s,x,x,48s,35s' %(value))\n",
      "        elif value == 'cylinder':\n",
      "            send_cmd('node kml-model symbol %s,x,x,128s,4s' %(value))            \n",
      "            send_cmd('node 3ds-model symbol %s,x,x,128s,4s' %(value))\n",
      "            send_cmd('node icon symbol %s,x,x,128s,4s' %(value))\n",
      "        elif value == 'cone':\n",
      "            send_cmd('node kml-model symbol %s,x,x,20s,64s' %(value))            \n",
      "            send_cmd('node 3ds-model symbol %s,x,x,20s,64s' %(value))\n",
      "            send_cmd('node icon symbol %s,x,x,20s,64s' %(value))\n",
      "        elif value == 'ellipse':\n",
      "            send_cmd('node kml-model symbol %s,x,x,84s,64s' %(value))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,84s,64s' %(value))\n",
      "            send_cmd('node icon symbol %s,x,x,84s,64s' %(value))\n",
      "   "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 737
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def select_symbol_test(widget):\n",
      "    print symbol_tests.values\n",
      "    print symbol_tests.value\n",
      "\n",
      "    symbol_dict = {'Cone/cylinder orientation tests':cone_cylinder_tests,\n",
      "               'Absolute/Relative symbol orientation':absolute_relative_tests}\n",
      "\n",
      "    symbolFunc = symbol_dict[symbol_tests.value]\n",
      "    symbolFunc()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 738
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def cone_cylinder_tests():\n",
      "    time.sleep(delay)\n",
      "    send_cmd('view symbol-view-2 ')\n",
      "    send_cmd('pitch 90')\n",
      "    send_cmd('node icon pos x,x,100')\n",
      "    send_cmd('node kml-model pos x,x,100')\n",
      "    send_cmd('node 3ds-model pos x,x,100')\n",
      "    x = 0\n",
      "    status (\"Symbol ORIENTATION 0 thru 360, 30 degree increments\")\n",
      "    collection = ['cone','cylinder']\n",
      "    for y in collection:\n",
      "        x = 0\n",
      "        if y == 'cone':\n",
      "            z = 0\n",
      "        else:\n",
      "            z = 30\n",
      "        while (x < 361):\n",
      "            send_cmd('node kml-model symbol %s,x,x,10s,64s,x,x,%d,%d' %(y,x,z))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,10s,64s,x,x,%d,%d' %(y,x,z))\n",
      "            send_cmd('node icon symbol %s,x,x,10s,64s,x,x,%d,%d' %(y,x,z))\n",
      " \n",
      "            x = x + 30\n",
      "            time.sleep(0.5)\n",
      "        x = 0\n",
      "        status (\"Symbol ELEVATION 0 thru 360, 30 degree increments\")\n",
      "        while (x < 361):\n",
      "            send_cmd('node kml-model symbol %s,x,x,10s,64s,x,x,%d,%d' %(y,z,x))\n",
      "            send_cmd('node 3ds-model symbol %s,x,x,10s,64s,x,x,%d,%d' %(y,z,x))\n",
      "            send_cmd('node icon symbol %s,x,x,10s,64s,x,x,%d,%d' %(y,z,x))\n",
      " \n",
      "            x = x + 30\n",
      "            time.sleep(0.5)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 739
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def absolute_relative_tests():\n",
      "    import math\n",
      "    send_cmd('sprite kml-model image 3D_Man_walking.kmz') \n",
      "    send_cmd('sprite 3ds-model image warrior/warrior.3ds ') \n",
      "    send_cmd('sprite icon image uav.png') \n",
      "\n",
      "    # position out of view\n",
      " \n",
      "    send_cmd('pitch 65')\n",
      "    collection = ['kml-model','3ds-model','icon']\n",
      "    for z in collection:\n",
      "        send_cmd('node icon pos 0,0,10000')\n",
      "        send_cmd('node kml-model pos 0,0,10000')\n",
      "        send_cmd('node 3ds-model pos 0,0,10000')\n",
      "        send_cmd('node %s type %s pos 0,0,10,c symbol cone,green,x,10s,90s,.9,x,90r,0 label green,relative' %(z,z))\n",
      "        angle = 0.0;\n",
      "        length = 50;\n",
      "        angle_stepsize = 0.1;\n",
      " \n",
      "        while (angle < 2 * math.pi):\n",
      "            x = length * math.cos(angle)\n",
      "            y = length * math.sin(angle)\n",
      "            send_cmd('node %s pos %d,%d ' %(z,x,y))\n",
      "            angle += angle_stepsize;\n",
      "            time.sleep(0.2)\n",
      "        \n",
      "        send_cmd('node %s type %s pos 0,0,10,c symbol cone,red,x,10s,90s,.9,x,90a,0 label red,absolute' %(z,z))        \n",
      "        angle = 0.0;\n",
      "        length = 50;\n",
      "        angle_stepsize = 0.1;\n",
      " \n",
      "        while (angle < 2 * math.pi):\n",
      "            x = length * math.cos(angle)\n",
      "            y = length * math.sin(angle)\n",
      "            send_cmd('node %s pos %d,%d ' %(z,x,y))\n",
      "            angle += angle_stepsize;\n",
      "            time.sleep(0.2)    \n",
      "            \n",
      "    send_cmd('node kml-model type man position 0,0,0,c label cyan ') \n",
      "    send_cmd('node 3ds-model type warrior position 0,100,0,c label cyan') \n",
      "    send_cmd('node icon type uav position 0,-100,0,c label cyan') \n",
      "\n",
      "            "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 740
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def view_tests():\n",
      "    reset_sdt3d()\n",
      "    \n",
      "    \n",
      "    view_txt_1 = widgets.TextWidget(description=\"flyTo: \", value=\"flyTo -77.013222,38.913611,500,0,45,1000\")\n",
      "    view_txt_2 = widgets.TextWidget(description=\"lookAt: \", value=\"lookAt -77.013222,38.913611,500,0,0,500\")\n",
      "    view_txt_3 = widgets.TextWidget(description=\"zoom: \", value=\"zoom 100\")\n",
      "    view_txt_4 = widgets.TextWidget(description=\"pitch: \", value=\"pitch 45\")\n",
      "    view_txt_5 = widgets.TextWidget(description=\"heading: \", value=\"heading 0\")\n",
      "    cmd = 'view bayBridge viewXml ' + os.getcwd() + '/data/bayBridge.xml'\n",
      "    view_txt_6 = widgets.TextWidget(description=\"viewXml: \", value=cmd)\n",
      "    view_button_7 = widgets.ButtonWidget(description=\"follow test\")\n",
      "    \n",
      "    view_txt_1.on_submit(view_test)\n",
      "    view_txt_2.on_submit(view_test)\n",
      "    view_txt_3.on_submit(view_test)\n",
      "    view_txt_4.on_submit(view_test)\n",
      "    view_txt_5.on_submit(view_test)\n",
      "    view_txt_6.on_submit(view_test)\n",
      "    view_button_7.on_click(view_test_follow)\n",
      "    \n",
      "    popup = widgets.PopupWidget(description=\"View Tests\")\n",
      "    popup.children=[view_txt_1, view_txt_2, view_txt_3, view_txt_4, view_txt_5, view_txt_6, view_button_7]\n",
      "    display(popup)\n",
      "    \n",
      "    \n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 741
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def view_test(widget):\n",
      "    send_cmd(widget.value)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 742
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def view_test_follow(widget):\n",
      "    import math\n",
      "    send_cmd('origin -112.082344,40.5006')\n",
      "    send_cmd('sprite sat image satellite.png')\n",
      "    #send_cmd('zoom 100')\n",
      "    send_cmd('node testNode type sat symbol sphere,yellow pos 0,0,0,c ')\n",
      "    stepsize = 10;\n",
      "    alt = 10\n",
      "    send_cmd('follow testNode')\n",
      "    x = 0;\n",
      "    while (x < 1000):\n",
      "        send_cmd('node testNode pos 0,%d,%d,c ' %(x,alt))\n",
      "        x += stepsize;\n",
      "        time.sleep(1)   \n",
      "    send_cmd('follow off')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 743
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def layer_test():\n",
      "    print \"Layer Test\"\n",
      "    send_cmd('status \"Reset perspective and delete any state\"')\n",
      "    send_cmd('resetPerspective')\n",
      "    send_cmd('delete all,all')\n",
      "    time.sleep(2)\n",
      "    delay=5\n",
      "    # Turn off all layers\n",
      "    send_cmd('status \"Turning off all layers\" ')\n",
      "    send_cmd('layer \"All Layers::Worldwind,off\" ')\n",
      "    time.sleep(1)\n",
      "    send_cmd('layer \"All Layers::Sdt,off\" ')\n",
      "    time.sleep(1)\n",
      "    send_cmd('layer \"All Layers::User Defined,off\" ')\n",
      "    time.sleep(delay)\n",
      "    # Turn on all layers\n",
      "    send_cmd('status \"Turning on all layers\" ')\n",
      "    send_cmd('layer \"All Layers::Worldwind,on\" ')\n",
      "    time.sleep(1)\n",
      "    send_cmd('layer \"All Layers::Sdt,on\" ')\n",
      "    time.sleep(1)\n",
      "    send_cmd('layer \"All Layers::User Defined,on\" ')\n",
      "    time.sleep(delay)\n",
      "    # Customize a set of layers\n",
      "    send_cmd('status \"Set up earth at night perspective\" ')\n",
      "    send_cmd('layer \"All Layers::Worldwind,off\" ')\n",
      "    send_cmd('layer \"All Layers::Sdt,off\" ')\n",
      "    send_cmd('layer \"All Layers::Worldwind::Earth at Night\" ')\n",
      "    send_cmd('layer \"All Layers::Worldwind::Atmosphere\" ')\n",
      "    send_cmd('layer \"All Layers::Worldwind::View Controls\" ')\n",
      "    send_cmd('layer \"All Layers::Sdt::Node Symbols\" ')\n",
      "    send_cmd('layer \"All Layers::Sdt::Node Labels\" ')\n",
      "    send_cmd('layer \"All Layers::User Defined,on\" ')\n",
      "    time.sleep(delay)\n",
      "    # User layers\n",
      "    send_cmd('status \"Create some custom layers\"')\n",
      "    send_cmd('layer TestLayer1 ')\n",
      "    send_cmd('layer TestLayer2 ')\n",
      "    send_cmd('layer TestLayer3 ')\n",
      "    send_cmd('layer TestLayer4 ')\n",
      "    send_cmd('layer \"All Layers::User Defined,on\" ')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"fly to node locations\"')\n",
      "    send_cmd('flyTo 0,0,500000,X,X,1')\n",
      "    time.sleep(delay)\n",
      "\n",
      "    send_cmd('status \"Add a few blue nodes to TestLayer1\"')\n",
      "    send_cmd('node node1 symbol sphere,blue,x,x,x,.9 nodeLayer TestLayer1 pos -1,0.5,50000')\n",
      "    send_cmd('node node2 symbol sphere,blue,x,x,x,.9 nodeLayer TestLayer1 pos -1,-0.5,50000')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Add a few red nodes to TestLayer2\"')\n",
      "    send_cmd('node node3 symbol sphere,red,x,x,x,.9 nodeLayer TestLayer2 pos 1,0.5,50000')\n",
      "    send_cmd('node node4 symbol sphere,red,x,x,x,.9 nodeLayer TestLayer2 pos 1,-0.5,50000')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Toggle off TestLayer1\"')\n",
      "    send_cmd('layer \"All Layers::User Defined::TestLayer1,off\"')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Toggle off TestLayer2\"')\n",
      "    send_cmd('layer \"All Layers::User Defined::TestLayer2,off\"')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Turn TestLayer1 back on\"')\n",
      "    send_cmd('layer \"All Layers::User Defined::TestLayer1,on\"')\n",
      "    time.sleep(delay)\n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 744
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def node_positioning():\n",
      "    send_cmd(' flyTo -76.005217,39.119009,100000 ')\n",
      "    delay=5\n",
      "    time.sleep(delay)\n",
      "    # Position node and symbols at geodesic coordinates\n",
      "    send_cmd('status \"Basic Node Tests\" ')\n",
      "    send_cmd('node node1 symbol sphere,red,50,x,x,1.0 ')\n",
      "    send_cmd('node node1 pos \"-77.005217,38.819009,5000\" ')\n",
      "    send_cmd('node node2 symbol cube,blue,200,x,x,0.75 ')\n",
      "    send_cmd('node node2 pos \"-76.005217,38.819009,10000\" ')\n",
      "    send_cmd('node node3 symbol sphere,yellow,500,x,x,0.5 ')\n",
      "    send_cmd('node node3 pos \"-75.005217,38.819009,20000\" ')\n",
      "    # Position node at geodesic coordinates\n",
      "    send_cmd('node node4 symbol sphere,purple,50,x,x,1.0 ')\n",
      "    send_cmd('node node4 pos \"-77.005217,39.119009,5000\" ')\n",
      "    send_cmd('node node5 symbol cube,green,200,x,x,0.75 ')\n",
      "    send_cmd('node node5 pos \"-76.005217,39.119009,10000\" ')\n",
      "    send_cmd('node node6 symbol cone,white,500,x,x,0.5 ')\n",
      "    send_cmd('node node6 pos \"-75.005217,39.119009,20000\" ')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('layer \"All Layers::Sdt::Node Labels,off\" ')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 745
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def model_test():\n",
      "    reset_sdt3d()\n",
      "    send_cmd('bgbounds -120.8091,35.7414,-120.768,35.7646')\n",
      "    send_cmd(' origin -120.8026,35.7528,0.0')\n",
      "\n",
      "    global model_tests\n",
      "    model_tests = widgets.RadioButtonsWidget(\n",
      "        values=['KML & 3ds Models at default size', \n",
      "               'Fixed length 132 meter models',\n",
      "               'Scaleable fixed length 132 meter models',\n",
      "               'Position at 100 agl',\n",
      "               'Position at 100 msl',\n",
      "               'Change heading of models 0-360, 30 degree increments',\n",
      "               'Change pitch of models 0-360, 30 degree increments',\n",
      "               'Change roll of models 0-360, 30 degree increments'])\n",
      "    \n",
      "    model_test_button = widgets.ButtonWidget(description=\"Select\")\n",
      "    model_test_button.on_click(select_model_test)\n",
      "\n",
      "    zoom_slider = widgets.IntSliderWidget(value=0,min=0.0,max=10000.0,step=10, description='Change zoom')\n",
      "    zoom_slider.on_trait_change(change_zoom, 'value')\n",
      "    \n",
      "    popup = widgets.PopupWidget(description=\"Model Tests\")\n",
      "\n",
      "    popup.children=[model_tests,model_test_button,zoom_slider]\n",
      "    display(popup)    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 746
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def change_zoom(name,value):\n",
      "    #print value\n",
      "    send_cmd('zoom %d' %(value))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 747
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def select_model_test(widget):\n",
      "\n",
      "    model_dict = {'KML & 3ds Models at default size':default_model_tests,\n",
      "               'Fixed length 132 meter models':fixed_model_tests,\n",
      "               'Scaleable fixed length 132 meter models':scaleable_fixed_models,\n",
      "               'Position at 100 agl':agl_test,\n",
      "               'Position at 100 msl':msl_test,\n",
      "               'Change heading of models 0-360, 30 degree increments':heading_tests,\n",
      "               'Change pitch of models 0-360, 30 degree increments':pitch_tests,\n",
      "               'Change roll of models 0-360, 30 degree increments':roll_tests}\n",
      "        \n",
      "    modelFunc = model_dict[model_tests.value]\n",
      "    modelFunc()    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 748
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def default_model_tests():\n",
      "    send_cmd('sprite man image 3D_Man_walking.kmz')\n",
      "    send_cmd('node kml-model type man position 0,0,0,c label cyan ')\n",
      "    send_cmd('sprite warrior image warrior/warrior.3ds ')\n",
      "    send_cmd('node 3ds-model type warrior position 0,700,0,c label cyan')\n",
      "   "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 749
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def fixed_model_tests():\n",
      "    send_cmd('sprite man-132 image 3D_Man_walking.kmz length 132')\n",
      "    send_cmd('sprite warrior-132 image warrior/warrior.3ds length 132 ')\n",
      "    send_cmd('node 3ds-model type warrior-132 position 0,0,0,c label cyan')\n",
      "    send_cmd('node kml-model type man-132 position 0,700,0,c label cyan')\n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 750
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def scaleable_fixed_models():\n",
      "    send_cmd('sprite man-32s image 3D_Man_walking.kmz size 32,64')\n",
      "    send_cmd('sprite warrior-32s image warrior/warrior.3ds size 32,32')\n",
      "    send_cmd('node 3ds-model type warrior-32s position 0,0,0,c label cyan')\n",
      "    send_cmd('node kml-model type man-32s position 0,700,0,c label cyan')\n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 751
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def agl_test():\n",
      "    send_cmd('node 3ds-model pos 0,700,100,c,agl label cyan')\n",
      "    send_cmd('node kml-model pos 0,0,100,c,agl label cyan')  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 752
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def msl_test():\n",
      "    send_cmd('node 3ds-model pos 0,700,100,c,msl label cyan')\n",
      "    send_cmd('node kml-model pos 0,0,100,c,msl label cyan')\n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 753
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def heading_tests():\n",
      "    send_cmd('pitch 90')\n",
      "    send_cmd('node 3ds-model pos 0,700,300,c,agl')\n",
      "    send_cmd('node kml-model pos 0,0,300,c,agl')\n",
      "    time.sleep(3)\n",
      "    status(\"Change heading of models 0 thru 360, 30 degree increments\")\n",
      "    x = 0\n",
      "    while (x < 361):\n",
      "        orientation_test('3ds-model',0,x,0)\n",
      "        orientation_test('kml-model',0,x,0)\n",
      "        x = x + 30\n",
      "        time.sleep(1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 754
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def pitch_tests():\n",
      "    x = 0\n",
      "    status (\"Change pitch of models 0 thru 360, 30 degree increments\")\n",
      "    while (x < 361):\n",
      "        orientation_test('3ds-model',x,0,0)\n",
      "        orientation_test('kml-model',x,0,0)\n",
      "        x = x + 30\n",
      "        time.sleep(1)   "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 755
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def roll_tests():\n",
      "    x = 0\n",
      "    status (\"Change roll of models 0 thru 360, 30 degree increments\")\n",
      "    while (x < 361):\n",
      "        orientation_test('3ds-model',0,0,x)\n",
      "        orientation_test('kml-model',0,0,x)\n",
      "        x = x + 30\n",
      "        time.sleep(1)\n",
      "      "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 756
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def orientation_test(node,pitch,yaw,roll):\n",
      "    cmd = ' node %s orientation %d,%d,%d' % (node,pitch,yaw,roll);\n",
      "    print cmd\n",
      "    send_cmd(cmd)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 757
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def link_test_manual():\n",
      "    \n",
      "    reset_sdt3d()\n",
      "    send_cmd(' origin -120.8026,35.7528,0.0') \n",
      "    send_cmd('view link-test viewXml ' + os.getcwd() + '/data/link-test.xml')\n",
      "    send_cmd('view link-test')\n",
      "    send_cmd('layer \"All Layers::Sdt::Link Labels,on\"')\n",
      "    send_cmd('layer \"All Layers::Sdt::Markers\"')\n",
      "\n",
      "    #send_cmd('sprite saucer image saucer.gif size 144,52')\n",
      "    send_cmd('node node1 pos -100,100,10,c')\n",
      "    send_cmd('node node2 pos -100,-100,10,c')\n",
      "    send_cmd('node node3 pos 100,100,10,c')\n",
      "    send_cmd('node node4 pos 100,-100,10,c')    \n",
      "    \n",
      "    global node_1 \n",
      "    node_1 = widgets.ToggleButtonsWidget(\n",
      "        description='From Node:', value='node1',\n",
      "        values=['node1','node2','node3','node4'])\n",
      "    #node1.on_trait_change(on_default_symbol_change,'value')\n",
      "    global node_2 \n",
      "    node_2 = widgets.ToggleButtonsWidget(\n",
      "        description='From Node:', value='node2',\n",
      "        values=['node1','node2','node3','node4'])\n",
      "    \n",
      "    \n",
      "    global name\n",
      "    name = widgets.TextWidget(description='link ID:',value='')\n",
      "    global color\n",
      "    color = widgets.DropdownWidget(description='color:', values=['black', 'white', 'yellow', 'green', \n",
      "        'blue', 'cyan', 'red', 'pink', 'orange', 'magenta', 'purple', 'gray'],value='green')\n",
      "    global line_width\n",
      "    line_width = widgets.DropdownWidget(description='link width:', values=['1', '2', '3', '4', '5', '6', '7'],value='2')\n",
      "    global directed    \n",
      "    directed = widgets.CheckboxWidget(description=\"directed:\", value=False)\n",
      "    global link_txt_1\n",
      "    global link_txt_2\n",
      "    global link_txt_3\n",
      "    global link_txt_4\n",
      "    link_txt_1 = widgets.TextWidget(description=\"node1 pos: \", value=\"pos -100,100,10,c\")\n",
      "    link_txt_2 = widgets.TextWidget(description=\"node2 pos: \", value=\"pos -100,-100,10,c\")\n",
      "    link_txt_3 = widgets.TextWidget(description=\"node3 pos: \", value=\"pos 100,100,10,c\")\n",
      "    link_txt_4 = widgets.TextWidget(description=\"node4 pos: \", value=\"pos 100,-100,10,c\")\n",
      "    draw_link_button = widgets.ButtonWidget(description=\"Draw link\")\n",
      "    unlink_button = widgets.ButtonWidget(description=\"Unlink\")\n",
      "    clear_links_button = widgets.ButtonWidget(description=\"Clear Links\")\n",
      "    draw_link_button.on_click(draw_link)\n",
      "    unlink_button.on_click(unlink)\n",
      "    clear_links_button.on_click(clear_links)\n",
      "    \n",
      "    link_txt_1.on_submit(link_txt_1_sub)\n",
      "    link_txt_2.on_submit(link_txt_2_sub)\n",
      "    link_txt_3.on_submit(link_txt_3_sub)\n",
      "    link_txt_4.on_submit(link_txt_4_sub)\n",
      "\n",
      "    \n",
      "    link_popup = widgets.PopupWidget(description=\"Draw Links\")\n",
      "    link_popup.children=[node_1,node_2,name,color,line_width,directed,link_txt_1, link_txt_2,\n",
      "                         link_txt_3,link_txt_4,draw_link_button,unlink_button,clear_links_button]\n",
      "    display(link_popup)\n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 758
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def clear_links(widget):\n",
      "    send_cmd('delete link,all')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 759
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def unlink(widget):\n",
      "    cmd = 'unlink %s,%s' %(node_1.value,node_2.value)\n",
      "    if name.value != '':\n",
      "        cmd = '%s,%s' %(cmd,name.value)\n",
      "    else:\n",
      "        cmd = '%s,X' %(cmd)\n",
      "        \n",
      "    if directed.value == True:\n",
      "        send_cmd('%s,dir' %(cmd))\n",
      "    else:\n",
      "        send_cmd('%s,all' %(cmd))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 760
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def link_txt_1_sub(widget):\n",
      "    send_cmd('node node1 %s' %(link_txt_1.value))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 761
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def link_txt_2_sub(widget):\n",
      "    send_cmd('node node2 %s' %(link_txt_2.value))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 762
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def link_txt_3_sub(widget):\n",
      "    send_cmd('node node3 %s' %(link_txt_3.value))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 763
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def link_txt_4_sub(widget):\n",
      "    send_cmd('node node4 %s' %(link_txt_4.value))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 764
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def draw_link(widget):\n",
      "    cmd = ' link %s,%s' % (node_1.value,node_2.value);\n",
      "\n",
      "    if name.value != '':\n",
      "        cmd = '%s,%s' %(cmd,name.value)\n",
      "    else:\n",
      "        cmd = '%s,X' %(cmd)\n",
      "    \n",
      "    if directed.value == True:\n",
      "        cmd = '%s,dir' %(cmd)\n",
      " \n",
      "    \n",
      "    cmd = '%s line %s,%s' %(cmd,color.value,line_width.value)\n",
      "        \n",
      "    if name.value != '':\n",
      "        cmd = '%s linklabel on,%s' %(cmd,name.value)\n",
      "    \n",
      "    print cmd\n",
      "    send_cmd(cmd)\n",
      "    \n",
      "    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 765
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def link_test_auto():\n",
      "    delay=5\n",
      "    reset_sdt3d()\n",
      "    send_cmd('flatEarth on')\n",
      "    send_cmd('layer \"All Layers::Worldwind,off\"')\n",
      "    send_cmd('backgroundColor 215:215:215')\n",
      "    send_cmd('lookAt 0,0,500000,X,X,500000')\n",
      "    send_cmd('layer \"All Layers::User Defined::TestLayer1,on\"')\n",
      "    send_cmd('layer \"All Layers::User Defined::TestLayer2,on\"')\n",
      "    send_cmd('layer \"All Layers::Sdt::Network Links,on\" ')\n",
      "    send_cmd('node node1 symbol sphere,blue,x,x,x,.2 nodeLayer TestLayer1 pos -1,0.5,50000')\n",
      "    send_cmd('node node2 symbol sphere,blue,x,x,x,.2 nodeLayer TestLayer1 pos -1,-0.5,50000')\n",
      "    send_cmd('node node3 symbol sphere,red,x,x,x,.2 nodeLayer TestLayer2 pos 1,0.5,50000')\n",
      "    send_cmd('node node4 symbol sphere,red,x,x,x,.2 nodeLayer TestLayer2 pos 1,-0.5,50000')    \n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Create wifi link between node1 and node3\" ')\n",
      "    send_cmd('link node1,node3,wifi line blue,2 linklabel on ')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Turn on link labels\"')\n",
      "    send_cmd('layer \"All Layers::Sdt::Link Labels\"')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Create UFH link between node1 and node3\"')\n",
      "    send_cmd('link node1,node3,UHF line red,2 linklabel on ')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Unlinking wifi nodes\"')\n",
      "    send_cmd('unlink node1,node3,wifi ')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Unlinking UHF nodes\"')\n",
      "    send_cmd('unlink node1,node3,UHF ')\n",
      "    time.sleep(delay)\n",
      "    status('Create many links')\n",
      "    send_cmd('link node1,node3,UHF line red,2 linklabel on ')\n",
      "    send_cmd('link node1,node3,wifi line blue,2 linklabel on ') \n",
      "    send_cmd('link node2,node4,wifi line blue,2 linklabel on ')\n",
      "    send_cmd('link node2,node4,eth1 line yellow,3 linklabel on ')\n",
      "    send_cmd('link node2,node4,eth2 line yellow,3 linklabel on ')\n",
      "    send_cmd('link node1,node2,wifi line blue,2 linklabel on')\n",
      "    send_cmd('link node1,node2,UHF line red,2 linklabel on')\n",
      "    send_cmd('link node3,node4,wifi line blue,2 linklabel on')\n",
      "    time.sleep(delay)\n",
      "    status('collapseLinks on')\n",
      "    send_cmd('collapseLinks on')\n",
      "    time.sleep(delay)\n",
      "    status('collapseLinks off')\n",
      "    send_cmd('collapseLinks off')\n",
      "    time.sleep(delay)\n",
      "    status('unlink wifi links')\n",
      "    send_cmd('unlink node1,node2,wifi')\n",
      "    send_cmd('unlink node1,node3,wifi')\n",
      "    send_cmd('unlink node2,node4,wifi')\n",
      "    send_cmd('unlink node3,node4,wifi')\n",
      "    time.sleep(delay)\n",
      "    status('unlink all links between node2 & node4')\n",
      "    send_cmd('unlink node2,node4,all')\n",
      "    time.sleep(delay)\n",
      "    send_cmd('status \"Turn on link direction markers\"')\n",
      "    \n",
      "    send_cmd('layer \"All Layers::Sdt::Markers\"')\n",
      "    send_cmd('delete link,all')\n",
      "    time.sleep(delay)\n",
      "    status('Create a uni-directional link 2 -> 4')\n",
      "    send_cmd('link node2,node4,wifi,dir line green,3 linklabel wifi-directed') \n",
      "    time.sleep(delay)\n",
      "    status('Create a uni-directional link 4 -> 2')\n",
      "    send_cmd('link node4,node2,wifi,dir line green,3 linklabel on')\n",
      "    time.sleep(delay)\n",
      "    status('Create a bi-directional link. \\nNotice the uni-directional links are deleted')\n",
      "    send_cmd('link node4,node2,wifi line yellow,3 linklabel on')\n",
      "    time.sleep(delay)\n",
      "    status('Create a uni-directional link.  Notice the bi-directional link is deleted')\n",
      "    send_cmd('link node4,node2,wifi,dir line green,3, linklabel on')\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 766
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def clear_all():\n",
      "    status('clear all')\n",
      "    send_cmd('clear all')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 767
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def delete_all():\n",
      "    status('delete all,all')\n",
      "    send_cmd('delete all,all')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 768
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def status(cmd):\n",
      "    send_cmd('status \"' + cmd + '\"')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 769
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def send_cmd(cmd):\n",
      "#    print cmd\n",
      "    sdtsock.sendall(' ' + cmd + ' ')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 770
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def reset_sdt3d():\n",
      "    send_cmd(' resetPerspective')\n",
      "    send_cmd(' clear all')\n",
      "    notebookpath = os.getcwd();\n",
      "    send_cmd('path %s/data/' %(notebookpath))\n",
      "    #send_cmd(' path /Users/ljt/sdt-2.0/trunk/test-suites/notebooks/data')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 771
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import time\n",
      "from IPython.html import widgets\n",
      "from IPython.display import display\n",
      "import socket\n",
      "import os\n",
      "delay=0\n",
      "sdt_addr=\"127.0.0.1\"\n",
      "sdt_port=50000\n",
      "sdtsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n",
      "container = widgets.ContainerWidget()\n",
      "control_1 = widgets.TextWidget(description=\"sdt3d: \", value=\"/usr/local/bin/sdt3d.sh\")\n",
      "#control_1.on_trait_change(on_value_change,'value')\n",
      "control_2 = widgets.TextWidget(description=\"arguments: \", value='listen tcp,50000')\n",
      "control_3 = widgets.ButtonWidget(description=\"Submit\")\n",
      "control_3.on_click(click_handler)\n",
      "container.children = [control_1, control_2, control_3]\n",
      "container_1 = container\n",
      "\n",
      "container_2 = widgets.ContainerWidget()\n",
      "control_12 = widgets.TextWidget(description=\"sdtcmd: \", value=\"/usr/local/bin/sdtcmd\")\n",
      "control_22 = widgets.TextWidget(description=\"cmd: \")\n",
      "control_22.on_submit(sdtcmd_handler)\n",
      "container_2.children = [ control_12 , control_22 ]\n",
      "\n",
      "control_13 = widgets.TextWidget(description=\"ip: \", value=\"127.0.0.1\")\n",
      "#control_1.on_trait_change(on_value_change,'value')\n",
      "control_23 = widgets.TextWidget(description=\"port: \", value='50000')\n",
      "control_33 = widgets.ButtonWidget(description=\"Connect\")\n",
      "control_33.on_click(connect)\n",
      "container_4 = widgets.ContainerWidget()\n",
      "container_4.children = [ control_13 , control_23, control_33]\n",
      "\n",
      "unit_tests = widgets.RadioButtonsWidget(\n",
      "    values=['Symbol Tests','Region Tests','Sprite Models', 'View Tests','Toggle Layers','Node Positioning',\n",
      "            'Link Test Manual','Link Test Auto','Clear All','Delete All'],)\n",
      "unit_test_button = widgets.ButtonWidget(description=\"Select\")\n",
      "unit_test_button.on_click(select_test)\n",
      "test_container = widgets.ContainerWidget(children=[unit_tests,unit_test_button])\n",
      "\n",
      "accordian = widgets.AccordionWidget(children=[container_1,container_4,container_2,test_container] )\n",
      "accordian.set_title(0,\"Start sdt3d\")\n",
      "accordian.set_title(1,\"Connect to sdt3d\")\n",
      "accordian.set_title(2,\"sdtcmd utility\")\n",
      "accordian.set_title(3,\"Unit Tests\")\n",
      "\n",
      "popup = widgets.PopupWidget(description=\"Sdt3d Unit Tests\")\n",
      "popup.children = [accordian]\n",
      "popup\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Connecting to 127.0.0.1/50000\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit test Sprite Models\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " node 3ds-model orientation 0,0,0\n",
        " node kml-model orientation 0,0,0\n",
        " node 3ds-model orientation 30,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 30,0,0\n",
        " node 3ds-model orientation 60,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 60,0,0\n",
        " node 3ds-model orientation 90,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 90,0,0\n",
        " node 3ds-model orientation 120,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 120,0,0\n",
        " node 3ds-model orientation 150,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 150,0,0\n",
        " node 3ds-model orientation 180,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 180,0,0\n",
        " node 3ds-model orientation 210,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 210,0,0\n",
        " node 3ds-model orientation 240,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 240,0,0\n",
        " node 3ds-model orientation 270,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 270,0,0\n",
        " node 3ds-model orientation 300,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 300,0,0\n",
        " node 3ds-model orientation 330,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 330,0,0\n",
        " node 3ds-model orientation 360,0,0"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " node kml-model orientation 360,0,0\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit test Symbol Tests\n",
        "Default Size\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "sphere\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "210 msl\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit test Region Tests\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "circle\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-4\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-6\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-12\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-16\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-18\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-19\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-18\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-17\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-16\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-15\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-14\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-13\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-12\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-10\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-8\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-7\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-6\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-5\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-4\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "3\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "4\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "6\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "8\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "11\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "12\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "14\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "16\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "17\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "18\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "21\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "22\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "23\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "24\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "25\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "26\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "24\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "18\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "17\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "12\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "3\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-3\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-4\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-5\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-6\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-7\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-8\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-10\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-11\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-12\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-13\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-14\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-16\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-17\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-18\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-19\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-20\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-22\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-23\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-24\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-25\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-26\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-28\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-30\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-31\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-32\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-33\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-34\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-35\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-36\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-37\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-39\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-40\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-42\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-43\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-44\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-45\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-46\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-47\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-48\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-47\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-29\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "4\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "35\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "38\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "41\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "39\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "38\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "37\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "36\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "35\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "32\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "31\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "29\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "28\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "27\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "26\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "25\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "24\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "23\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "22\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "21\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "20\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "19\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "18\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "17\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "16\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "14\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "13\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "12\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "10\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "8\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "7\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "6\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "5\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "4\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-3\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-4\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-5\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-6\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-7\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-8\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "sphere\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-10\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-7\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-3\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "6\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "11\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "12\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "15\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "17\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "19\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "20\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "21\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "25\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "26\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "28\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "32\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "34\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "37\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "45\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "47\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "49\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "51\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "53\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "56\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "58\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "59\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "60\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "61\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "62\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "63\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "64\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "66\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "67\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "68\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "70\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "71\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "72\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "73\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "72\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "67\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "63\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "58\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "51\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "43\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "24\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "17\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "13\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "4\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-5\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-6\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-11\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-12\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-14\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-16\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-19\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-22\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-24\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-26\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-28\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-30\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-32\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-33\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-37\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-38\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-40\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-42\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-43\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-45\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-46\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-47\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-46\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-45\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-43\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-41\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-38\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-30\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-26\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-21\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-15\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "3\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "9\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "16\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "23\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "43\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "51\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "57\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "65\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "84\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "89\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "94\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "98\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "100\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "94\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "86\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "73\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "66\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "59\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "52\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "37\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "24\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "18\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "13\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-3\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-6\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-16\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-19\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-22\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-26\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-30\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-32\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-42\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-45\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-48\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-51\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-53\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-55\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-56\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-57\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-60\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-61\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-63\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-65\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-66\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-69\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-71\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-73\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-75\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-79\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-81\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-83\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-85\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-88\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-90\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-91\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-92\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-94\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-95\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-96\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-98\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-99\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-100\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-96\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-68\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-54\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-28\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "-12\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "16\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "31\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "53\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "63\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "73\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "87\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "95\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "100\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit test View Tests\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit test Toggle Layers\n",
        "Layer Test\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit test Node Positioning\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit test Node Positioning\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit test Link Test Manual\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit test Link Test Manual\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " link node1,node2,X line green,2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " link node1,node2,X,dir line green,2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " link node2,node1,X,dir line green,2\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " link node2,node1,eth1,dir line red,2 linklabel on,eth1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " link node1,node2,eth1,dir line red,2 linklabel on,eth1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " link node1,node2,eth1,dir line red,2 linklabel on,eth1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " link node2,node1,eth1,dir line red,2 linklabel on,eth1\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " link node2,node1,eth1 line red,2 linklabel on,eth1\n"
       ]
      }
     ],
     "prompt_number": 772
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def on_value_change(name, value):\n",
      "    print(value)\n",
      "    print(name)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 773
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def test():\n",
      "    x = 0\n",
      "    status (\"Change roll of models 0 thru 360, 30 degree increments\")\n",
      "    while (x < 361):\n",
      "        send_cmd('node kml-model symbol cone,x,x,10s,64s,x,x,%d' %(x))\n",
      "        send_cmd('node 3ds-model symbol cone,x,x,10s,64s,x,x,%d' %(x))\n",
      "        send_cmd('node icon symbol cone,x,x,10s,64s,x,x,%d' %(x))\n",
      " \n",
      "        x = x + 30\n",
      "    \n",
      "        time.sleep(1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 774
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# print out all widget types\n",
      "#[n for n in dir(widgets) ]\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 775
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#slider = widgets.IntSliderWidget(value=0,min=5.0,max=10000,step=0.2, description='Test')\n",
      "#display(slider)\n",
      "def button_0():\n",
      "    print \"button 0\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 776
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "int_range = widgets.IntSliderWidget()\n",
      "display(int_range)\n",
      "int_range.on_trait_change(on_value_change, 'value')\n",
      "\n",
      "def on_value_change(name, value):\n",
      "    print(value)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 777
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 777
    }
   ],
   "metadata": {}
  }
 ]
}